<template>
  <j-modal
    :title="title"
    :width="1500"
    :visible="visible"
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    cancelText="关闭">
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="编号">
              <a-input placeholder="请输入编号" v-model="queryParam.code"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="名称">
              <a-input placeholder="请输入名称" v-model="queryParam.name"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <a-spin :spinning="confirmLoading">
      <j-form-container :disabled="disableSubmit">
        <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
          <a-row>
            <a-table
              class="j-table-force-nowrap1"
              size="middle"
              bordered
              :dataSource="dataSource"
              :columns="columns"
              :rowKey="(record) => record.rowKey"
              :rowSelection="{type:'radio',selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
              :pagination="ipagination"
            ></a-table>
          </a-row>
        </a-form-model>
      </j-form-container>
    </a-spin>
  </j-modal>

</template>

<script>

import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin'
import { getAction } from '@api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import radio from 'ant-design-vue/lib/radio'

export default {
  name: 'MaterialNeedProcListModal',
  computed: {
  },
  mixins: [JVxeTableModelMixin,JeecgListMixin],
  components: {
  },
  data () {
    return {
      ipagination: {
        current: 1,
        pageSize: 20,
        pageSizeOptions: ['10', '20', '30'],
        showTotal: (total, range) => {
          return range[0] + "-" + range[1] + " 共" + total + "条"
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      dataSource: [],
      validatorRules:{},
      title:'统计',
      width:800,
      visible: false,
      disableSubmit: false,
      columns: [
        {
          title: '#',
          dataIndex: '',
          key:'rowIndex',
          width:60,
          align:"center",
          customRender:function (t,r,index) {
            return parseInt(index)+1;
          }
        },
        {
          title: '物料编码',
          align: 'center',
          dataIndex: 'code',
          width: 147
        },
        {
          title: '物料名称',
          align: 'center',
          dataIndex: 'name',
          width: 147
        },
        {
          title: '规格型号',
          align: 'center',
          dataIndex: 'noneSpec',
          width: 147
        },
        {
          title: '物料描述',
          align: 'center',
          dataIndex: 'categoryDescription',
          width: 100
        },
        {
          title: '单位',
          align: 'center',
          dataIndex: 'meUnit_dictText',
          width: 60
        },
        {
          title: '辅单位',
          align: 'center',
          dataIndex: 'auUnit_dictText',
          width: 60
        },
        {
          title: '换算率',
          align: 'center',
          dataIndex: 'coRate',
          width: 60
        },
      ],
      url: {
        list: '/base/erpGoods/list',
      }
    }
  },
  methods: {
    close () {
      this.$emit('close');
      this.visible = false;
    },
    handleOk () {
      console.log("11111111111111",this.selectionRows[0])
      let selectionRows = this.selectionRows[0];
      this.$nextTick(() => {
        this.$emit("Ok",selectionRows)
      })
      // this.searchReset(false)
      this.queryParam = {employeeCode:'',employeeName:''}
      this.onClearSelected();
      this.close();
    },
    submitCallback(){
      this.$emit('ok');
      this.visible = false;
    },
    handleCancel () {
      this.close()
    }
  }
}
</script>